<template>

  <el-select v-model="sync_value" :disabled="disabled" :multiple="multiple" placeholder="请选择品牌" filterable clearable @change="changeSelect">
    <el-option v-for="item in list" :key="item.classId" :label="item.className" :value="item.classId" />
  </el-select>

</template>

<script>
import propsync from '@/mixins/propsync'
import { goodsProvider } from '../../api/api'
export default {
  name: 'SelectBrand',
  mixins: [propsync],
  props: {
    value: {
      default: '',
      isSync: true
    },
    disabled: {
      type: Boolean,
      default: false
    },
    multiple: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      list: []
    }
  },
  mounted() {
    goodsProvider().listClass().then(data => {
      this.list = data.result.rows
    })
  },
  methods: {
    changeSelect(id) {
      const item = this.list.find(_ => _.id == id)
      this.$emit('selectChange', item)
    }
  }
}
</script>

<style scoped>

</style>
